package com.ruoyi.web.controller.newTable;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TTopic;
import com.ruoyi.system.service.ITTopicService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 学生参加本领域国内外重要学术会议情况Controller
 * 
 * @author ruoyi
 * @date 2024-12-06
 */
@RestController
@RequestMapping("/system/topic")
public class TTopicController extends BaseController
{
    @Autowired
    private ITTopicService tTopicService;

    /**
     * 查询学生参加本领域国内外重要学术会议情况列表
     */
    @PreAuthorize("@ss.hasPermi('system:topic:list')")
    @GetMapping("/list")
    public TableDataInfo list(TTopic tTopic)
    {
        startPage();
        List<TTopic> list = tTopicService.selectTTopicList(tTopic);
        return getDataTable(list);
    }

    /**
     * 导出学生参加本领域国内外重要学术会议情况列表
     */
    @PreAuthorize("@ss.hasPermi('system:topic:export')")
    @Log(title = "学生参加本领域国内外重要学术会议情况", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TTopic tTopic)
    {
        List<TTopic> list = tTopicService.selectTTopicList(tTopic);
        ExcelUtil<TTopic> util = new ExcelUtil<TTopic>(TTopic.class);
        util.exportExcel(response, list, "学生参加本领域国内外重要学术会议情况数据");
    }

    /**
     * 获取学生参加本领域国内外重要学术会议情况详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:topic:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tTopicService.selectTTopicById(id));
    }

    /**
     * 新增学生参加本领域国内外重要学术会议情况
     */
    @PreAuthorize("@ss.hasPermi('system:topic:add')")
    @Log(title = "学生参加本领域国内外重要学术会议情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TTopic tTopic)
    {
        return toAjax(tTopicService.insertTTopic(tTopic));
    }

    /**
     * 修改学生参加本领域国内外重要学术会议情况
     */
    @PreAuthorize("@ss.hasPermi('system:topic:edit')")
    @Log(title = "学生参加本领域国内外重要学术会议情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TTopic tTopic)
    {
        return toAjax(tTopicService.updateTTopic(tTopic));
    }

    /**
     * 删除学生参加本领域国内外重要学术会议情况
     */
    @PreAuthorize("@ss.hasPermi('system:topic:remove')")
    @Log(title = "学生参加本领域国内外重要学术会议情况", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tTopicService.deleteTTopicByIds(ids));
    }
}
